package com.jykj.modbus.equipment.service;

import com.jykj.modbus.equipment.entity.guard.EquipmentData;
import com.jykj.modbus.equipment.service.guard.EquipmentDataServiceGuard;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class EquipmentDataService extends EquipmentDataServiceGuard {

    /**
     * 通过设备信息获取设备结果信息
     * @param obj
     * @return
     */
    public List<EquipmentData> selectEquipmentDataList(EquipmentData obj){
        return dao.selectEquipmentDataList(obj);
    }

    /**
     * 通过条件获取1分钟内的数据
     * @param obj
     * @return
     */
    public List<EquipmentData> selectEquipmentDataByTime(EquipmentData obj){
        List<Map<String, Object>> mapList = this.dao.selectEquipmentDataByTime(obj);
        List<EquipmentData> edList = new ArrayList<EquipmentData>();
        for (Map<String, Object> map : mapList){
            edList.add((EquipmentData)map);
        }
        return edList;
    }
}
